<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('用户特征列表')" />
    <link href="/css/jsoneditor.min.css" rel="stylesheet" type="text/css">
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <p>uuid：</p>
                                <input type="text" id="uuid"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="query()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <div id="jsoneditor" style="width: 100%; height: 700px;"></div>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script src="/js/jsoneditor.min.js"></script>
    <script th:inline="javascript">

        var prefix = ctx + "wenyanwen/data";
        var container = document.getElementById("jsoneditor");
        var options = {
            mode: 'code',
            onValidationError: function (errors) {

            },
            onEditable: function(){
               return false;
            },
            mainMenuBar: false
        };
        var editor = new JSONEditor(container, options);

        function query(){

              var uuid = $('#uuid').val();
              if(!uuid){
                 $.modal.alertWarning("请输入UUID");
                 return;
              }

              $.ajax({
                type: "post",
                url: prefix + "/list",
                data: {
                    "uuid": uuid,
                },
                success: function(r) {
                    var json
                    if(r.code != 0){
                        json = {
                          "msg": r.msg
                        };
                    }else{
                        json = JSON.parse(r.data);
                    }

                    editor.set(json);
                }
             });
        }


    </script>
</body>
</html>